Test FAMS on 2D data
Contents
randomize data
max_uniform=100;
vect1 = rand(100,2)*max_uniform;
vect2 = randn(120,2);
vect2 = vect2.*repmat([1,1],size(vect2,1),1)+repmat([70,60],size(vect2,1),1);
vect3 = randn(150,2);
vect3 = vect3.*repmat([1,1],size(vect3,1),1)+repmat([30,90],size(vect3,1),1);
data=[vect1; vect2; vect3];
run FAMS
[modes, p_modes, w_modes]=fams(data,20,15,200,'2Ddata','res/');
Load data points from matlab ...done
RunFAMS with res/pilot_200_2Ddata.txt ...
Running FAMS with K=20 L=15
Run pilot adaptive...load bandwidths...done.
Start MS iterations..........done.
Join Modes with adaptive h/2, min pt=40, jump=1
pass 1done
pass 2..........nrel 2
0 0
1 1
done
Save convergence points ...done
Save joined convergence points ...done
Save indicies of modes ...done
FAMS done.
view results
figure(1),clf;
subplot(2,2,1),plot(data(:,1),data(:,2),'.');title('2D data');
subplot(2,2,2),hist(data(:,2));
subplot(2,2,3),hist(data(:,1));
p_modes
figure(2),clf;
subplot(2,2,1),plot(modes(:,1),modes(:,2),'.');title('after FAMS');
hold on; subplot(2,2,1),plot(p_modes(1:2,2),p_modes(1:2,3),'r.');
subplot(2,2,2),hist(modes(:,2));
subplot(2,2,3),hist(modes(:,1));
p_modes =
161.0000 29.9949 90.0097
128.0000 69.8201 59.8975